# coding=utf8
#phon_transcript class to represent a single transcript from CHILDES
import phon_data
import re
class phon_transcript():
    def __init__(self, title = None, author = None, url = None,
                 lang = None, data = [], subject = None, age = None):
        self.title = title
        self.author = author
        self.url = url
        self.lang = lang
        self.data = data
        self.subject = subject
        self.error = False
        self.text = ""
    def __repr__(self):
        return ("title: %s, lang: %s, subject: %s"
                % (self.title, self.lang,
                   self.subject))

    def printout(self):
        for token in self.data:
            print token

    def size(self):
        return len(data)
    def title_to_subject(self):
        """Finds the name of the subject from
        the title of the transcript"""
        p = re.compile(r'(?<=/)(?P<name>[a-z]+)(?=[0-9]+)')
        self.subject = p.findall(self.title)[0]
        
        
    
    
